﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Pcb.Common;

namespace Pcb.Web.admin
{
    public partial class index : Web.UI.ManagePage
    {
        protected static Model.manager admin_info;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                admin_info = GetAdminInfo();

                hsite_model.Value = IsAdminLevelToInt("site_model", DTEnums.ActionEnum.View.ToString()).ToString(); //是否有网站管理权限
            }
        }

        //安全退出
        protected void lbtnExit_Click(object sender, EventArgs e)
        {            
            //1超级管理员   2客户组	3销售人员组	  4财务人员组
            if (admin_info.role_id == 2)
            {
                Session[DTKeys.SESSION_ADMIN_INFO] = null;
                Utils.WriteCookie("AdminName", "Pcb", -14400);
                Utils.WriteCookie("AdminPwd", "Pcb", -14400);

                Response.Redirect("../index.aspx");
            }
            else
            {
                Session[DTKeys.SESSION_ADMIN_INFO] = null;
                Utils.WriteCookie("AdminName", "Pcb", -14400);
                Utils.WriteCookie("AdminPwd", "Pcb", -14400);

                Response.Redirect("login.aspx");
            }
        }
    }
}